<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../scripts/boot.js" type="text/javascript"></script>
<script src="../scripts/core.js" type="text/javascript"></script>
<title>招聘 </title>
</head>
<link href="../style/css/demo.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="../style/css/base.css" />
<link type="text/css" rel="stylesheet" href="../style/css/apply.css" />
<script language="javascript">
 mini.parse();
  var formNum=1;
  //var jsonArray={};
        function submitForm() {
            //window.location.href='applyWorkExperience.jsp';//测试用，之后把这句删了
            for(var i=1;i<=formNum;i++){
            var form = new mini.Form("#form"+i);
            //form.validate();
            //if (form.isValid() == false) return;
            //提交数据
            var data = form.getData();      
            var json = mini.encode([data]);
            //alert(json);
          //  jsonArray[i]=json;
           
            $.ajax({
                url: "../dataService/ApplyBaseService.jsp?method=addApplyBase",
                type: "post",
                data: { submitData: json },
                success: function (text) {
                    alert("提交成功，返回结果:" + text);
                    //window.location.href='applyWorkExperience.jsp';
                }
            });
        }
        window.location.href='applyProjectExperience.jsp';
        }
        function resetForm(e) {
            var form = new mini.Form("#form1");
            form.clear();
        }
      
        function addForm(){
        document.getElementById("content_apply").style.height="1000px";
        	formNum++;
        	var appendForm=document.getElementById("forms");
        	var newform = document.createElement('div'); 
        	newform.setAttribute("id","form"+formNum);
        	newform.innerHTML="<span style=cursor:pointer onclick=removeForm("+this.formNum+")>删除表单</span>"+
        	"<table border=0 cellpadding=1 cellspacing=10 style=width:60%;table-layout:fixed; align=center>"+
   "<tr>"+
        "<td ><span class=red>*</span>时间：</td>"+
        "<td>"+
            "<input name=from class=mini-datepicker value=2010-01-01 required=true/> "+
        "</td>"+
        "<td>到</td>"+
         "<td>"+
            "<input  name=to class=mini-datepicker value=2010-01-01 required=true/>"+
        "</td>"+
       
    "</tr>"+
	"<tr>"+
		"<td ><span class=red>*</span>雇主：</td>"+
        "<td>"+
            "<input name=guzhu class=mini-textbox emptyText=请输入雇主  required=true/>  <br /><br />"+
        "</td>"+
        " <td>"+
           "<span class=red>*</span>所属部门："+
        "</td>"+
        " <td>"+
           " <input  name=department class=mini-textbox emptyText=请输入所属部门  required=true/>  <br /><br />"+
       " </td>"+
	"</tr>"+
	"<tr>"+
		"<td ><span class=red>*</span>联系电话：</td>"+
        "<td>"+
           " <input  name=phone vtype=int class=mini-textbox emptyText=联系电话  required=true/>  <br /><br />"+
        "</td>"+
         "<td>"+
         "   <span class=red>*</span>工作地点："+
        "</td>"+
        " <td>"+
            "<input  name=workplace class=mini-textbox emptyText=工作地点 required=true />  <br /><br />"+
        "</td>"+
	"</tr>"+
	"<tr>"+
		"<td ><span class=red>*</span>职位：</td>"+
        "<td>"+
            "<input  name=position class=mini-textbox emptyText=职位  required=true/>  <br /><br />"+
        "</td>"+
        " <td>"+
            "<span class=red>*</span>所属行业："+
        "</td>"+
         "<td>"+
            "<input  name=industry class=mini-textbox emptyText=所属行业  required=true/>  <br /><br />"+
        "</td>"+
	"</tr>"+
	"<tr>"+
	"<td>工作描述：</td>"+
	"<td colspan=4 align=left>"+
	"<input  name=description  style=width:400px;height:60px; class=mini-textarea required=true/>"+
	"</td>"+
	"</tr>"+
	"<tr>"+
	"<td>主要业绩：</td>"+
	"<td colspan=4 align=left>"+
	"<input  name=achievement  style=width:400px;height:60px; class=mini-textarea required=true/>"+
	"</td>"+
	"</tr>"+
	
"</table>";
			
        	appendForm.appendChild(newform);
        	mini.parse();
        }
        
        function removeForm(num){
        	    mini.confirm("确定删除表单 "+num+"？", "确定？",
            function (action) {
                if (action == "ok") {
                var parent=document.getElementById("forms");
        	var child=document.getElementById("form"+num);
        	parent.removeChild(child);
        	formNum--;
                    //alert("已删除!");
                } else {
                   // alert("不删除!");
                }
            }
        );
        	
        }
</script>
<body>
<%@include file="head.jsp" %>
<div class="container">
<div id="content_apply">
<br /><br /><br /><br />
<h3>工作经验</h3>
<div id="forms">
<div id="form1">
<table border="0" cellpadding="1" cellspacing="10" style="width:60%;table-layout:fixed;" align="center">
    <tr>
        <td ><span class="red">*</span>时间：</td>
        <td>
            <input id="date1" name="from" class="mini-datepicker" value="2010-01-01" required="true"/> 
        </td>
        <td>到</td>
         <td>
            <input id="date2" name="to" class="mini-datepicker" value="2010-01-01" required="true"/>
        </td>
       
    </tr>
	<tr>
		<td ><span class="red">*</span>雇主：</td>
        <td>
            <input id="guzhu" name="guzhu" class="mini-textbox" emptyText="请输入雇主"  required="true"/>  <br /><br />
        </td>
         <td>
            <span class="red">*</span>所属部门：
        </td>
         <td>
            <input id="department" name="department" class="mini-textbox" emptyText="请输入所属部门"  required="true"/>  <br /><br />
        </td>
	</tr>
	<tr>
		<td ><span class="red">*</span>联系电话：</td>
        <td>
            <input id="phone" name="phone" vtype="int" class="mini-textbox" emptyText="联系电话"  required="true"/>  <br /><br />
        </td>
         <td>
            <span class="red">*</span>工作地点：
        </td>
         <td>
            <input id="workplace" name="workplace" class="mini-textbox" emptyText="工作地点" required="true" />  <br /><br />
        </td>
	</tr>
	<tr>
		<td ><span class="red">*</span>职位：</td>
        <td>
            <input id="position" name="position" class="mini-textbox" emptyText="职位"  required="true"/>  <br /><br />
        </td>
         <td>
            <span class="red">*</span>所属行业：
        </td>
         <td>
            <input id="hangye" name="industry" class="mini-textbox" emptyText="所属行业"  required="true"/>  <br /><br />
        </td>
	</tr>
	<tr>
	<td>工作描述：</td>
	<td colspan="4" align="left">
	<input id="gongzuomiaoshu" name="description"  style="width:400px;height:60px;" class="mini-textarea" required="true"/>
	</td>
	</tr>
	<tr>
	<td>主要业绩：</td>
	<td colspan="4" align="left">
	<input id="zhuyaoyeji" name="achievement"  style="width:400px;height:60px;" class="mini-textarea" required="true"/>
	</td>
	</tr>
	
</table>
</div>
</div>
<table align="center">
<tr>
	<td>
		<span style="cursor:pointer" onclick="addForm()">继续添加</span>
	</td>
	<td></td>
	<td></td>
	<td></td>
	</tr>
 <tr>
            <td>
                 
            </td>
            <td class="sub">
            <a href="#" onclick="submitForm()">保存&下一步</a>                             
            </td>
            <td class="sub">
            
            <a href="#" onclick="resetForm()">重置</a>                                    
            </td>
            <td></td>
    </tr>
    </table>
</div>
</div>
<%@include file="bottom.jsp" %>
</body>
</html>

